﻿
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using HRProject.Code.Common;

namespace HRProject.Code.DTO
{
    public class BLInputType
    {
        public const int STRING = 0;
        public const int BOOLEAN = 1;
        public const int NUMBER = 2;
        public const int DATETIME = 3;
        public const int SELECTION = 4;
        public const int PARAGRAPH = 5;
        public const int FILE = 6;

        public static string GetName(int inputType)
        {
            switch (inputType)
            {
                case STRING:
                    return ContentProvider.GetValue("InputType_String");
                case BOOLEAN:
                    return ContentProvider.GetValue("InputType_Boolean");
                case NUMBER:
                    return ContentProvider.GetValue("InputType_Number");
                case DATETIME:
                    return ContentProvider.GetValue("InputType_DateTime");
                case SELECTION:
                    return ContentProvider.GetValue("InputType_Selection");
                case PARAGRAPH:
                    return ContentProvider.GetValue("InputType_Paragraph");
                case FILE:
                    return ContentProvider.GetValue("InputType_File");
                default:
                    return ContentProvider.GetValue("InputType_String");
            }
        }

        public static List<InputTypeObject> List
        {
            get
            {
                List<InputTypeObject> result = new List<InputTypeObject>();
                result.Add(new InputTypeObject(STRING, ContentProvider.GetValue("InputType_String")));
                result.Add(new InputTypeObject(BOOLEAN, ContentProvider.GetValue("InputType_Boolean")));
                result.Add(new InputTypeObject(NUMBER, ContentProvider.GetValue("InputType_Number")));
                result.Add(new InputTypeObject(DATETIME, ContentProvider.GetValue("InputType_Time")));
                result.Add(new InputTypeObject(SELECTION, ContentProvider.GetValue("InputType_Selection")));
                result.Add(new InputTypeObject(PARAGRAPH, ContentProvider.GetValue("InputType_Paragraph")));
                result.Add(new InputTypeObject(FILE, ContentProvider.GetValue("InputType_File")));
                return result;
            }
        }
    }

    public class InputTypeObject
    {
        private int id;
        private string name;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        public string Name
        {
            get { return name; }
            set
            {
                if (value == null)
                    name = string.Empty;
                else
                    name = value.Trim();
            }
        }

        public override string ToString()
        {
            return name;
        }

        public InputTypeObject(int pId, string pName)
        {
            id = pId;
            name = pName;
        }
    }
}
